package com.baymax.test.scene.demo

import android.graphics.Picture
import android.net.LinkProperties
import android.net.Network
import android.net.NetworkInfo
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.core.graphics.record
import com.airbnb.mvrx.MavericksState
import com.baymax.test.scene.BaseGroupScene
import com.baymax.test.scene.addButton
import com.baymax.test.scene.addDFView
import com.baymax.test.scene.demo.maverick.CounterDemo
import com.baymax.test.scene.demo.maverick.MainCrashDemo
import com.baymax.test.scene.demo.maverick.RequestNetWork
import com.baymax.test.scene.newSceneFlexContainer
import com.bytedance.scene.Scene
import com.bytedance.scene.ktx.replace

class MaverickDemo : BaseGroupScene() {
    override fun onCreateView(
        p0: LayoutInflater,
        p1: ViewGroup,
        p2: Bundle?
    ): ViewGroup = p1.newSceneFlexContainer {

        val pid = View.generateViewId()
        val pic = Picture()

        val pushScene = { scene: Scene ->
            replace(pid, scene, "host")
        }
        addButton("counter-demo") {
            pushScene(CounterDemo())
        }
        addButton("network") {
            pushScene(RequestNetWork())
        }
        addButton("main loop") {
            pushScene(MainCrashDemo())
        }



        addDFView(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT,
            FrameLayout(context).apply { id = pid }
        )
    }


}